﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Concat
{
    class StructObject
    {
        public StructType type;
        public ConcatType effectiveType;
        public Dictionary<string, object> slots;

        public StructObject(StructType type, params string[] slot_names)
        {
            this.type = type;
            this.effectiveType = null;
            slots = new Dictionary<string, object>();
            foreach (string slot_name in slot_names)
                slots[slot_name] = null;
        }
        private StructObject(StructType type, ConcatType effectiveType, Dictionary<string, object> slots)
        {
            this.type = type;
            this.effectiveType = effectiveType;
            this.slots = new Dictionary<string, object>(slots);
        }

        public StructObject copy()
        {
            return new StructObject(type, effectiveType, slots);
        }

        public ConcatType getType()
        {
            return effectiveType ?? type;
        }
    }
}
